﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WXYW.Entities;
using WXYW.DAL;

namespace WXYW.BLL
{
    public class ResourceService:RepositoryBase
    {
        public IQueryable<Resource> GetResourceByStatus(string status)
        {
            return GetEntities<Resource>(r => r.Status == status).OrderByDescending(r => r.SubmitDate);
        }

        public void AddResource(Resource resource)
        {
            InsertEntity(resource);
        }

        public void UpdateResource(Resource resource)
        {
            UpdateEntity(resource);
        }

        public Resource getResourceByID(long p)
        {
            return GetEntities<Resource>(r => r.ID == p).FirstOrDefault();
        }
    }
}
